home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
emulator
/
patch-0.60
/
patch-0.60.4-dpmi
Wrap
Text File
|
1995-12-06
|
3KB
|
86 lines
*** dpmi/dpmi.c.orig Sat Nov 4 18:46:44 1995
--- dpmi/dpmi.c Wed Dec 6 11:33:33 1995
***************
*** 190,195 ****
--- 190,205 ----
#define vm86_regs sigcontext
#endif
unsigned long RealModeContext;
+ /*
+ * With this stack nested PM programs like DJ200's make/compiler work fine
+ * (maybe Borkland's protected mode make/compiler too).
+ * For do_int31
+ * 0x0300: Simulate Real Mode Interrupt
+ * 0x0301: Call Real Mode Procedure With Far Return Frame
+ * 0x0302: Call Real Mode Procedure With Iret Frame
+ */
+ unsigned long RealModeContext_Stack[DPMI_max_rec_rm_func];
+ unsigned long RealModeContext_Running = 0;
static INTDESC Interrupt_Table[0x100];
static INTDESC Exception_Table[0x20];
***************
*** 982,987 ****
--- 992,1013 ----
/*2ch*/ *++lp = 0xffffffff;
}
+ static inline void save_rm_context()
+ {
+ if (RealModeContext_Running >= DPMI_max_rec_rm_func) {
+ error("DPMI: RealModeContext_Running = 0x%4x\n",RealModeContext_Running++);
+ return;
+ }
+ RealModeContext_Stack[RealModeContext_Running++] = RealModeContext;
+ }
+
+ static inline void restore_rm_context()
+ {
+ if (RealModeContext_Running-- > DPMI_max_rec_rm_func)
+ return;
+ RealModeContext = RealModeContext_Stack[RealModeContext_Running];
+ }
+
static inline void save_rm_regs()
{
if (DPMI_rm_procedure_running >= DPMI_max_rec_rm_func) {
***************
*** 1231,1236 ****
--- 1257,1263 ----
case 0x0301: /* Call Real Mode Procedure With Far Return Frame */
case 0x0302: /* Call Real Mode Procedure With Iret Frame */
save_rm_regs();
+ save_rm_context();
RealModeContext = GetSegmentBaseAddress(_es) + (DPMIclient_is_32 ? _edi : _LWORD(edi));
{
struct RealModeCallStructure *rmreg = (struct RealModeCallStructure *) RealModeContext;
***************
*** 2088,2094 ****
my_sp = LWORD(esp);
NOCARRY;
! save_rm_regs();
REG(cs) = DPMI_SEG;
REG(eip) = DPMI_OFF + HLT_OFF(DPMI_return_from_dos);
--- 2115,2123 ----
my_sp = LWORD(esp);
NOCARRY;
! if(!in_dpmi) { /* Don't eat rm regs if already in dpmi */
! save_rm_regs();
! }
REG(cs) = DPMI_SEG;
REG(eip) = DPMI_OFF + HLT_OFF(DPMI_return_from_dos);
***************
*** 2944,2949 ****
--- 2973,2979 ----
} else if (lina == (unsigned char *) (DPMI_ADD + HLT_OFF(DPMI_return_from_realmode))) {
struct RealModeCallStructure *rmreg = (struct RealModeCallStructure *) RealModeContext;
+ restore_rm_context();
D_printf("DPMI: Return from Real Mode Procedure\n");
#ifdef SHOWREGS